from RandomList import GetRandomList
import timeit


class Node:
    def __init__(self,item = 0):
        self.key = item
        self.left,self.right = None,None

def insert(key):
    global root
    root = insert_rec(root, key)

def insert_rec(root, key):
    if (root == None):
        root = Node(key)
    if (key < root.key):
        root.left = insert_rec(root.left, key)
    elif (key > root.key):
        root.right = insert_rec(root.right, key)
    return root

def inorder_rec(root):
    if (root != None):
        inorder_rec(root.left)
        inorder_rec(root.right)

def tree_selecting_sort(arr):
    for i in range(len(arr)):
        insert(arr[i])



if __name__ == "__main__":
    root = Node()
    root = None
    Arr = GetRandomList(50000)
    print("Dual Pivot Sort Running Time is " + str(round(timeit.timeit(lambda :tree_selecting_sort(Arr), number = 1) * 1000, 3 )) + " ms")